﻿using UnityEngine;
using System.Collections;
using System.IO;
using Cmd;
using GameData;
using LitJson;

public class ClientManager
{
    public static void ClientActionRef(BinaryReader reader)
    {
        Debug.Log("CS-返回消息");
        string ActionName = reader.ReadString();
        //进行转发
        switch (ActionName)
        {
            case "CS注册":
                //
                RegistSend.DoCallBack("CS注册", reader.ReadBoolean());
                break;
            case "CS登录":
              
                LoginSend.DoCallBack("CS登录",JsonMapper.ToObject<RoleInfo>(reader.ReadString()));
                break;
            case "CS领取":
                ReceiveNumSend.DoCallBack("CS领取",JsonMapper.ToObject<NumberInfo>(reader.ReadString()));
                break;
            case "CS统计数据":
                ReceiveCountSend.DoCallBack("CS统计数据", JsonMapper.ToObject<NumAllInfo>(reader.ReadString()));
                break;
            case "CS抽号":
                PickNumSend.DoCallBack("CS抽号", JsonMapper.ToObject<PickNumInfo>(reader.ReadString()));
                break;
            case "CS心跳":
                HeartbeatSend.DoCallBack("CS心跳", JsonMapper.ToObject<NumAllInfo>(reader.ReadString()));

                break;
            case "CS排号信息":
                PickAllInfoSend.DoCallBack("CS排号信息", JsonMapper.ToObject<PickAllNumInfo>(reader.ReadString()));
                break;
            case "CS处理":
                DueNumberSend.DoCallBack("CS处理", JsonMapper.ToObject<NumberInfo>(reader.ReadString()));
                break;
            case "CS完成办理":
                CompleteNumberSend.DoCallBack("CS完成办理", JsonMapper.ToObject<NumberInfo>(reader.ReadString()));
                break;
            case "CS放弃办理":
                CancleNumberSend.DoCallBack("CS放弃办理", JsonMapper.ToObject<NumberInfo>(reader.ReadString()));
                break;
            case "CS处理名单":
                DueNumberListSend.DoCallBack("CS处理名单", JsonMapper.ToObject<DueNuminfos>(reader.ReadString()));
                break;
            case "CS设置窗口":
                SetWindowNumSend.DoCallBack("CS设置窗口", JsonMapper.ToObject<NumberInfo>(reader.ReadString()));
                break;
            case "CS呼叫":
                CallNumberSend.DoCallBack("CS呼叫", JsonMapper.ToObject<CallNumber>(reader.ReadString()));
                break;
            case "CS所有名单":
                GetAllNumberSend.DoCallBack("CS所有名单", JsonMapper.ToObject<AllNumbers>(reader.ReadString()));
                break;
            case "CS添加数量":
                AddCurlNumberSend.DoCallBack("CS添加数量", JsonMapper.ToObject<NumAllInfo>(reader.ReadString()));
                break;
            case "CS一次抽取数":
                SetOncePickNumSend.DoCallBack("CS一次抽取数", JsonMapper.ToObject<NumAllInfo>(reader.ReadString()));
                break;
            case "CS添加VIP":
                SetNumToVIPSend.DoCallBack("CS添加VIP", JsonMapper.ToObject<NumListData>(reader.ReadString()));
                break;
            case "CS取号和VIP信息":
                GetRecAndVIPNumSend.DoCallBack("CS取号和VIP信息", JsonMapper.ToObject<NumListData>(reader.ReadString()));
                break;
            case "CS清空数据":
                CleanGlobalSend.DoCallBack("CS清空数据", JsonMapper.ToObject<RoleInfo>(reader.ReadString()));
                break;
            case "CS新增号码数量":
                CreateNumByNum.DoCallBack("CS新增号码数量", JsonMapper.ToObject<NumListData>(reader.ReadString()));
                break;
            case "CS设置语种":
                SetSoundType.DoCallBack("CS设置语种", JsonMapper.ToObject<SoundType>(reader.ReadString()));
                break;
            case "CS获取语种":
                GetSoundType.DoCallBack("CS获取语种", JsonMapper.ToObject<SoundType>(reader.ReadString()));
                break;
            case "CS信息抽号":
                GetRecNumToNUm.DoCallBack("CS信息抽号", JsonMapper.ToObject<AllNumbers>(reader.ReadString()));
                break;
            case "CS设置取号方式":
                SetRecType.DoCallBack("CS设置取号方式", JsonMapper.ToObject<RecNumType>(reader.ReadString()));
                break;
            case "CS获取取号方式":
                GetRecNumType.DoCallBack("CS获取取号方式", JsonMapper.ToObject<RecNumType>(reader.ReadString()));
                break;
            case "CS设置数据":
                Cmd.SetDataInfo.DoCallBack("CS设置数据", JsonMapper.ToObject<DataInfo>(reader.ReadString()));
                break;
            case "CS获取数据":
                Cmd.GetDataInfo.DoCallBack("CS获取数据", JsonMapper.ToObject<DataInfo>(reader.ReadString()));
                break;
            case "CS新增客户":
                Cmd.NewCustomerInfo.DoCallBack("CS新增客户", JsonMapper.ToObject<NumberData>(reader.ReadString()));
                break;
            case "CS领取所有号码":
                Cmd.TestGetAllNumer.DoCallBack("CS领取所有号码", JsonMapper.ToObject<ResponserData>(reader.ReadString()));
                break;
            case "CS清空抽号":
                Cmd.ClearPickNum.DoCallBack("CS清空抽号", JsonMapper.ToObject<PickNumInfo>(reader.ReadString()));
                break;
            case "CS获取队列信息":
                Cmd.GetPickNum.DoCallBack("CS获取队列信息", JsonMapper.ToObject<PickNumInfo>(reader.ReadString()));
                break;
            case "CS获取客户情况":
                Cmd.GetCustomerInfo.DoCallBack("CS获取客户情况", JsonMapper.ToObject<CustomerSignDataList>(reader.ReadString()));
                break;
                //GetCustomerInfo
        }

    }

    public static void PushClientAction(BinaryReader reader)
    {
        
        string ActionName = reader.ReadString();
        Debug.Log("SC-推送消息--消息类型:"+ ActionName);
        switch (ActionName)
        {
            case "SC统计数据":
                S2C_NumberCountInfo.DoCallBack("SC统计数据", JsonMapper.ToObject<NumAllInfo>(reader.ReadString()));
                break;
            case "SC抽号":
                S2C_PickNumInfo.DoCallBack("SC抽号", JsonMapper.ToObject<PickNumInfo>(reader.ReadString()));
                break;
            case "SC排号信息":
                S2C_PickAllInfo.DoCallBack("SC排号信息", JsonMapper.ToObject<PickAllNumInfo>(reader.ReadString()));

                break;
            case "SC处理名单":
                S2C_DueNumbers.DoCallBack("SC处理名单", JsonMapper.ToObject<DueNuminfos>(reader.ReadString()));

                break;
            case "SC叫号":
                S2C_CallNumber.DoCallBack("SC叫号", JsonMapper.ToObject<CallNumber>(reader.ReadString()));

                break;
            case "SC取号和VIP信息":
                S2C_RecAndVIPNum.DoCallBack("SC取号和VIP信息", JsonMapper.ToObject<NumListData>(reader.ReadString()));
                break;
            case "SC设置语种":
                S2C_SetSoundType.DoCallBack("SC设置语种", JsonMapper.ToObject<SoundType>(reader.ReadString()));
                break;
            case "SC设置取号方式":
                S2C_SetRecType.DoCallBack("SC设置取号方式", JsonMapper.ToObject<RecNumType>(reader.ReadString()));
                break;
            case "SC队列信息":
                S2C_PickQueueNum.DoCallBack("SC队列信息", JsonMapper.ToObject<PickNumInfo>(reader.ReadString()));
                break;
            case "SC设置数据":
                S2C_SetDataInfo.DoCallBack("SC设置数据", JsonMapper.ToObject<SetDataInfoDic>(reader.ReadString()));
                break;
        }

    }



}
